<?php

session_cache_expire(999999999);
include 'operations/connection.php';

$lang = $_REQUEST['lang'];
$company = $_REQUEST['company'];
$idEmployee = $_REQUEST['id_employee'];
$idGroup = $_REQUEST['idgroupapprove'];
$comment = $_REQUEST['comment'];
$id_approvedoc = $_REQUEST['id_approvedoc'];
$co = 0;


if (empty($lang) || $lang == "EN") {
    $value = "value/value_en.php";
} else if ($lang == "VN") {
    $value = "value/value_vn.php";
} else {
    $value = "value/value_kr.php";
}
include($value);
$db = mysql_query("SELECT l.id_status FROM list_reference l WHERE l.id_employee='$idEmployee' AND l.id_group='$idGroup';");
while ($r = mysql_fetch_array($db)) {
    $co = 1;
    if ($r[id_status] == 2) {
        mysql_query("update list_reference set id_status = 1 WHERE id_group=$idGroup AND id_employee=$idEmployee");
        echo "<script>
						alert('Ban da xac nhan van ban thanh cong');
					</script>";
    }
    if ($r[id_status] == 1) {
        echo "<script>
						alert('Ban da xac nhan van ban nay roi');
					</script>";
    }
    if ($r[id_status] == 4) {
        echo "<script>
						alert('Van ban chua duoc phe duyet');
					</script>";
    }
}
if ($co == 0) {
    echo "<script>
						alert('" . $l_thongbao5 . "');
					</script>";
}

mysql_close($connection);
echo "<script>
		window.close();
		</script>";
?>